

package cn.shengchao.examstar.product.acl.ports.repositories;

import cn.shengchao.examstar.comment.acl.ports.repositories.message.CourseListDto;
import cn.shengchao.examstar.product.domain.entity.Course;
import cn.shengchao.examstar.product.domain.entity.CourseKnowledgeNode;
import cn.shengchao.examstar.product.domain.entity.Product;
import cn.shengchao.examstar.product.domain.entity.Teacher;
import cn.shengchao.examstar.product.infrastructure.dao.po.TProductCourseNodes;
import cn.shengchao.examstar.rpc.product.req.CourseQueryPage;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.Optional;

/**
 * 产品仓储
 */
public interface IProductRepository {

    /**
     * 根据id查询产品
     *
     * @param id
     * @return
     */
    Optional<Product> findById(Long id);

    /**
     * 根据名称，规格查询课程
     */
    List<Course> findCourseByProductNameAndSpecifications(String productName, String specifications, List<Long> ids);

    /**
     * 获取课程
     */
    List<Teacher> findTeacherByCourseId(Long courseId);
    /**
     * 查看课程知识点
     */
    List<CourseKnowledgeNode> findListByCourseIdByNewOrder(Long courseId, String searchName, boolean isLesson);

    /**
     * 查看课程知识点
     */
    List<CourseKnowledgeNode> findListByCourseId(Long courseId, String searchName, boolean isLesson);

    /**
     * 获取知识点
     */
    CourseKnowledgeNode getKnowledgeNode(Long knowledgeNodeId);

    /**
     * 根据产品id查询产品名称
     */
    Map<Long, String> findNameByIds(List<Long> productIds);

    List<Course> findCourseByIds(List<Long> ids);

    /**
     * 获取课程id
     */
    List<Long> findCourseIdByTeacherId(Long teacherId);

    /**
     * 课程
     */
    List<CourseListDto> getCourseList(CourseQueryPage courseQueryPage);
    /**
     * getCourseList课程总价
     */
    Map<String, BigDecimal> sumCourseListPrice(CourseQueryPage courseQueryPage);
    void deleteCourse(Long courseId);

    List<Long> getKnowledgeIds(Long courseId, boolean isLesson);

    List<Long> findCourseIdByTeacherName(String searchValue);

    List<TProductCourseNodes> findCourseNodesByProductIds(List<Long> productIds,boolean isLesson);


    List<Long> findCourseNodesByParentLessonId(Long productId);
}
